﻿<%@ Page Language="C#" MasterPageFile="~/Master/Site.Master" AutoEventWireup="true"
    CodeBehind="user.aspx.cs" Inherits="聚欣订单分析.user" Title="无标题页" %>

<%@ Register Assembly="DevExpress.Web.v18.1, Version=18.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web" TagPrefix="dx" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="CPH_NAV" runat="server">
    <h2>用户管理</h2>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="CPH_Contents" runat="server">
    <div style="padding-left: 50px">
        <dx:ASPxGridView ID="ASPxGridView1" KeyFieldName="ID" runat="server" DataSourceID="SqlDataSource1"
            Width="98%" OnRowValidating="ASPxGridView1_RowValidating">
            <Columns>
                <dx:GridViewCommandColumn Caption="操作" VisibleIndex="9" Width="100px" ShowNewButton="true" ShowEditButton="true" ShowDeleteButton="true" ShowClearFilterButton="true">
                </dx:GridViewCommandColumn>
                <dx:GridViewDataTextColumn FieldName="ID" ReadOnly="True" VisibleIndex="0" Visible="false">
                    <EditFormSettings Visible="False" />
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn Caption="用户名" FieldName="UserName" VisibleIndex="1">
                </dx:GridViewDataTextColumn>
                 <dx:GridViewDataTextColumn Caption="密钥" FieldName="pwd" VisibleIndex="1">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn Caption="真实姓名" FieldName="realname" VisibleIndex="1">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataComboBoxColumn Caption="角色" FieldName="qx" VisibleIndex="1">
                    <PropertiesComboBox>
                        <Items>
                            <dx:ListEditItem Text="超级管理员" Value="99" />
                            <dx:ListEditItem Text="市场管理员" Value="0" />
                            <dx:ListEditItem Text="区域业务员" Value="1" />
                            <dx:ListEditItem Text="区域管理员" Value="4" />
                            <dx:ListEditItem Text="财务" Value="2" />
                            <dx:ListEditItem Text="仓库" Value="3" />
                        </Items>
                    </PropertiesComboBox>
                </dx:GridViewDataComboBoxColumn>
                <dx:GridViewDataTextColumn Caption="所管区域" FieldName="qy" VisibleIndex="1">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn Caption="权限" FieldName="qtqx" VisibleIndex="1">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataSpinEditColumn Caption="折扣" FieldName="zk" VisibleIndex="1" Visible="false">
                    <PropertiesSpinEdit DecimalPlaces="2">
                    </PropertiesSpinEdit>
                </dx:GridViewDataSpinEditColumn>
            </Columns>
            <Settings ShowFilterRow="True" />
            <SettingsBehavior ConfirmDelete="true" />
            <SettingsText ConfirmDelete="确认删除吗？" />
        </dx:ASPxGridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:JXDDConnectionString %>"
            DeleteCommand="DELETE FROM [tbl_user] WHERE [ID] = @ID" InsertCommand="INSERT INTO [tbl_user] ([UserName], [pwd], [realname], [qx],[qy],[qtqx],[zk]) VALUES (@UserName, @pwd, @realname, @qx,@qy,@qtqx,@zk)"
            SelectCommand="SELECT * FROM [tbl_user]" UpdateCommand="UPDATE [tbl_user] SET [UserName] = @UserName, [realname] = @realname, [qx] = @qx,qy=@qy,qtqx=@qtqx,zk=@zk WHERE [ID] = @ID">
            <DeleteParameters>
                <asp:Parameter Name="ID" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="UserName" Type="String" />
                <asp:Parameter Name="realname" Type="String" />
                <asp:Parameter Name="qx" Type="String" />
                <asp:Parameter Name="qy" Type="String" />
                <asp:Parameter Name="qtqx" Type="String" />
                <asp:Parameter Name="zk" Type="Double" />
                <asp:Parameter Name="ID" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="UserName" Type="String" />
                <asp:Parameter Name="realname" Type="String" />
                <asp:Parameter Name="qx" Type="String" />
                <asp:Parameter Name="qy" Type="String" />
                <asp:Parameter Name="qtqx" Type="String" />
                <asp:Parameter Name="zk" Type="Double" />
                <asp:Parameter Name="pwd" Type="String" DefaultValue="0" />
            </InsertParameters>
        </asp:SqlDataSource>
    </div>
</asp:Content>
